package nam.bt.zajnbovv.jewels_new_pro.item;

import nam.bt.zajnbovv.jewels_new_pro.MySprite;
import nam.bt.zajnbovv.jewels_new_pro.mystatic.Constant;
 
import org.anddev.andengine.engine.Engine;
import org.anddev.andengine.opengl.texture.TextureOptions;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
import org.anddev.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
import org.anddev.andengine.opengl.texture.region.TextureRegion;
 
import android.content.Context;
 
/**
* Load resource jewel
*
* @author gioi
*
*/
public class LoadResourcesJewel extends MySprite {
    private BitmapTextureAtlas[] item_BTA;
    private TextureRegion[] item_TR;
 
    public TextureRegion getResourceName(int i) {
        return item_TR[i];
    }
 
    public void onLoadResources(Engine mEngine, Context mContext) {
        this.mEngine = mEngine;
        this.mContext = mContext;
 
        item_BTA = new BitmapTextureAtlas[Constant.MAX_ITEM_JEWEL];
        item_TR = new TextureRegion[Constant.MAX_ITEM_JEWEL];
 
        BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("image/jewel/");
 
        for (int i = 0; i < Constant.MAX_ITEM_JEWEL; i++) {
            this.item_BTA[i] = new BitmapTextureAtlas(128, 128,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
            this.item_TR[i] = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.item_BTA[i], mContext,Constant.ITEM_NAME_JEWEL[i], 0, 0);
            mEngine.getTextureManager().loadTextures(this.item_BTA[i]);
        }
    }
}
